package com.flink.ttest.cofig;

import com.alibaba.fastjson.JSON;
import org.apache.flink.streaming.api.functions.windowing.WindowFunction;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.util.Collector;

/**
 * @author: LCG
 * @date: 2022-06-28 16:16:08
 * @description:
 **/
public class OrderPriceCountWindow implements WindowFunction<Order,Order,String, TimeWindow> {

    @Override
    public void apply(String s, TimeWindow timeWindow, Iterable<Order> iterable, Collector<Order> collector) throws Exception {
        System.out.println("key==========>"+s);
        System.out.println("iterable==========>"+ JSON.toJSONString(iterable.iterator().next()));
        collector.collect(iterable.iterator().next());
    }
}
